<?php

namespace App\Http\Controllers\Admin;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Input;

class commencontroller extends Controller
{
    //
 public function upload(){

       $file=Input::file('Filedata');

       if ($file->isValid()){

        $realPath=$file->getRealPath();//零时文件的绝对路径
           $entension=$file->getClientOriginalExtension();//上传文件后缀
           $newName=date('YmdHis').mt_rand(100,999).'.'.$entension;

          $path=$file->move(base_path().'/upload',$newName);
          $filepath='upload/'.$newName;


          return asset($filepath);
       }




    }
}
